<?php 
if(!isset($_SESSION['tkemail'])){
		if(!isset($_COOKIE['role'])){
			//$_SESSION['action']='entry';
			header( 'Location: index.php?action=entry' );
		}else{
			$_SESSION['tkemail']=$_COOKIE["tkemail"];
		    $_SESSION['role']=$_COOKIE["role"];
			
			$role=$_SESSION['role'];
			$tkemail=$_SESSION['tkemail'];
		}
	}else{
		$role=$_SESSION['role'];
		$tkemail=$_SESSION['tkemail'];
	}
	if($tkemail==""){
		header( 'Location: index.php?action=entry' );
	}

?>
<link rel="stylesheet" type="text/css" href="js/jsDatePick_ltr.min.css" />
<link
	rel="stylesheet" type="text/css" href="css/style-login.css" />
<script
	type="text/javascript" src="js/jsDatePick.min.1.3.js"></script>
<script
	type="text/javascript"
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<link  href="css/jsDatePick_ltr.min.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="css/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
window.onload = function(){
	new JsDatePick({
		useMode:2,
		target:"searchfrom",

		dateFormat:"%Y-%m-%d"
	});
	new JsDatePick({
		useMode:2,
		target:"searchto",

		dateFormat:"%Y-%m-%d"
	});
};
</script>
<?php include 'connection/connection.php';?>
<?php 

	$lang=$_SESSION['lang'];
	if($lang=='')
			$lang='EN';
	
	if ( !isset($_REQUEST['page'] ))
	{
    	$page = 1 ;
	}else{
		$page = $_REQUEST['page'] ;
	}
	
	$rows_per_page = 20;
	$page_start = ( $page - 1 ) * $rows_per_page; 
	$page_end = $page * $rows_per_page;
	
	$datecurrent = date("Y-m-d");
	$temp2days = strtotime($datecurrent.'-1 days');
    $day2 =  date("Y-m-d",$temp2days);
	
    $temp7days = strtotime($datecurrent.'-6 days');
    $day7 =  date("Y-m-d",$temp7days);
    
	$temp1month = strtotime($datecurrent.'-1 months');
	$onemonth = date("Y-m-d",$temp1month);
	
	
	if(!isset($_REQUEST['page'])){
		$list["ui.email"]="DESC";
		$list["lvs.viewer_ip"]="DESC";
		$list["lvs.server_ip"]="DESC";
		$list["lvs.status"]="DESC";
		$list["lvs.ins_time"]="DESC";
		
		$str="lvs.ins_time";
		$_SESSION['sortn']=$str;
		$_SESSION['sort']=$list;
	}else{
		$str=$_SESSION['sortn'];
		$list=$_SESSION['sort'];
	}
	
if (isset($_REQUEST['search'])){
	$searchfrom = $_REQUEST['searchfrom'];
	$searchto = $_REQUEST['searchto'];
	$search = $_REQUEST['search'];
	$lstatus = $_REQUEST['status'];
	$sql = "SELECT lvs.*,ui.email FROM `user_info` ui, log_viewer_to_server lvs 
		WHERE lvs.id = ui.id and lvs.ins_time >'".$searchfrom." 00:00:00' AND lvs.ins_time<'".$searchto." 23:59:59'  ";
	
	$sql.= " AND lvs.`status` ='".$status."'";
	
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
	
}else if (isset($_REQUEST['searchAll'])){
	$lstatus = 'all';
	$searchfrom =date("Y-m-d");
	$searchto = date("Y-m-d");
	$sql = "SELECT lvs.*,ui.email FROM `user_info` ui, log_viewer_to_server lvs WHERE lvs.id = ui.id ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['searchone'])){
	$sql = "SELECT lvs.*,ui.email FROM `user_info` ui, log_viewer_to_server lvs 
		WHERE lvs.id = ui.id and lvs.ins_time >'".$datecurrent." 00:00:00' AND lvs.ins_time<'".$datecurrent." 23:59:59' ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['search2day'])){
	$sql ="SELECT lvs.*,ui.email FROM `user_info` ui, log_viewer_to_server lvs 
		WHERE lvs.id = ui.id and lvs.ins_time >'".$day2." 00:00:00'  AND lvs.ins_time<'".$datecurrent." 23:59:59'";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['search1week'])){
	$sql = "SELECT lvs.*,ui.email FROM `user_info` ui, log_viewer_to_server lvs 
		WHERE lvs.id = ui.id and lvs.ins_time >'".$day7." 00:00:00' and lvs.ins_time<='".$datecurrent." 23:59:59' ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['search1month'])){
	$sql = "SELECT lvs.*,ui.email FROM `user_info` ui, log_viewer_to_server lvs 
		WHERE lvs.id = ui.id and lvs.ins_time >'".$onemonth." 00:00:00' and lvs.ins_time<='".$datecurrent." 23:59:59' ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}
else{
	$lstatus = 'all';
	$searchfrom =date("Y-m-d");
	$searchto = date("Y-m-d");
	$sql = "SELECT lvs.*,ui.email FROM `user_info` ui, log_viewer_to_server lvs WHERE lvs.id = ui.id ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}

?>

<script type="text/javascript">
function ajaxserachLogViewertoServer(page,search){
	var searchfrom = $('input#searchfrom').val();
	var searchto = $('input#searchto').val();
	var status = document.getElementById('status').value; 

	document.getElementById('search').setAttribute("class", "buttonNormalchoose");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logviewertoserver/ajaxserachLogViewertoServer.php", data : {pages : page,search : search,searchfrom : searchfrom,searchto : searchto,status : status}, success:function(result){
	//	$("table#tbLogViewToServer tr:not(:first)").remove();
	//	$("table#tbLogViewToServer thead").append(result);
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}
function sortandpagingViewtoserver(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth){
	$.ajax({url:"ajax_logviewertoserver/sortandpagingViewtoserver.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
	
}

function ajaxsearchall(page,search){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';

	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormalchoose");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logviewertoserver/ajaxSearchAllLogViewertoServer.php", data : {pages : page,search : search}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}
function sortandpagingAllViewertoServer(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth){
	$.ajax({url:"ajax_logviewertoserver/sortandpagingAllViewertoServer.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}
// 4 buttons
function ajaxSearchLogViewertoServerByOneDay(page,search,searchOneDay){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';
	
	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormalchoose");
	
	$.ajax({url:"ajax_logviewertoserver/ajaxSearchLogViewertoServerByOneDay.php", data : {pages : page,search : search,searchOneDay : searchOneDay}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}

function sortandpagingViewtoSerByOneDay(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth){
	$.ajax({url:"ajax_logviewertoserver/sortandpagingViewtoSerByOneDay.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}

function ajaxSearchLogViewtoSerBy2Day(page,search,searchcurrent,searchlast2day){
	document.getElementById('searchfrom').value = "<?php echo date('Y-m-d',strtotime(date('Y-m-d').'-1 days'));?>";
	document.getElementById('searchto').value = "<?php echo date('Y-m-d');?>";
	document.getElementById('status').value = 'all';

	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormalchoose");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logviewertoserver/ajaxSearchLogViewtoSerByTwoDay.php", data : {pages : page,search : search,searchcurrent : searchcurrent,searchlast2day : searchlast2day}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}

function sortandpagingViewtoSerByTwoDay(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth){
	document.getElementById('searchfrom').value = "<?php echo date('Y-m-d',strtotime(date('Y-m-d').'-1 days'));?>";
	document.getElementById('searchto').value = "<?php echo date('Y-m-d');?>";
	$.ajax({url:"ajax_logviewertoserver/sortandpagingViewtoSerByTwoDay.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}

function ajaxSearchLogViewtoSerBy7Days(page,search,searchcurrent,searchlast7day){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';

	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormalchoose");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logviewertoserver/ajaxSearchLogViewtoSerBy7Day.php", data : {pages : page,search : search,searchcurrent : searchcurrent,searchlast7day : searchlast7day}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}

function sortandpagingViewtoSerBy7Day(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth){
	$.ajax({url:"ajax_logviewertoserver/sortandpagingViewtoSerBy7Day.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}

function ajaxSearchLogViewtoSerBy1Months(page,search,searchcurrent,searchlast1month){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';

	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormalchoose");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logviewertoserver/ajaxSearchLogViewtoSerBy1Month.php", data : {pages : page,search : search,searchcurrent : searchcurrent,searchlast1month : searchlast1month}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}

function sortandpagingViewtoSerBy1Month(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth){
	$.ajax({url:"ajax_logviewertoserver/sortandpagingViewtoSerBy1Month.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth}, success:function(result){
		$("table#tbLogViewToServer").empty();
		$("table#tbLogViewToServer").append(result);
	}});
}
</script>
<div class="maincon1">
	<div class="hbox">
		<h2>
		<?=$login?>
		</h2>
		<p>
		<?=$login1?>
		</p>
		<div class="seldown">
			<ul>
			<?php if ($role==0){?>
				<li class="hoso" style="float:left;">
		        	<a href="#" onclick="changePage('profile')" style="background:url(images/bg_aa.png) no-repeat; display:block; width:145px; height:71px"><span><?=$hoso?></span></a>
		        </li>
		        <li class="giayphep" style="float:left;">
		        	<a href="#" onclick="changePage('license')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$namelicense?></span></a>
		        </li>
			<?php }else if ($role==1){?>
				<li class="hoso" style="float:left;">
		        	<a href="#" onclick="changePage('profile')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$hoso?></span></a>
		        </li>
		        <li class="giayphep" style="float:left;">
		        	<a href="#" onclick="changePage('license')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$namelicense?></span></a>
		        </li>
		        <li class="server" style="float:left;">
		       	<a href="#" onclick="changePage('log_server')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px;cursor: pointer;"><span><?=$logserver?></span></a>
		        </li>
		        <li class="viewer" style="float:left;">
		        	<a href="#"  onclick="changePage('logviewer')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$logviewer?></span></a>
		        </li>
		        <li class="viewertoserver" style="float:left;">
		        	<a onclick="changePage('log_viewertoserver')" style="background:url(images/bg_aa.png) no-repeat; display:block; width:145px; height:71px"><span class="chooseViewtoServer"><?=$logviewertoserver?></span></a>
		        </li>
			<?php }?>
		    	
	  	  </ul>
		</div>
	</div>
</div>
<div style="text-align: center;padding-left: 40px;">
	<?=$l_from?> : <input type="text" id="searchfrom" name="searchfrom" style="height: 24px;width: 83px;">
	<?=$l_to?> : <input type="text" id="searchto" name="searchto" style="height: 24px;width: 83px;">
	<?=$namestatus?> : 
	<select id="status" name="status" style="height: 24px;width: 100px;padding-top: 3px;">
		<option value="all"><?=$l_all?></option>
		<option value="connected"><?=$l_connected?></option>
		<option value="disconnect"><?=$l_disconnect?></option>
	</select>
	<input id="search" name="search" value="<?=$l_search?>"
				  class="buttonNormal" type="button" onclick="ajaxserachLogViewertoServer(1,'<?=$search?>')" />
	<input id="searchAll" name="searchAll" value="<?=$l_all?>"
				  class="buttonNormalchoose" type="button" onclick="ajaxsearchall(1,'<?=$search?>')" />
	<input id="searchone" name="search" value="<?php echo $oneday?>"
				  class="buttonNormal" type="button" onclick="ajaxSearchLogViewertoServerByOneDay(1,'<?=$search?>','<?=$datecurrent?>')"/>
	<input id="search2day" name="searchAll" value="<?php echo $twoday?>"
				  class="buttonNormal" type="button" onclick="ajaxSearchLogViewtoSerBy2Day(1,'<?=$search?>','<?=$datecurrent?>','<?=$day2?>')"/>
	<input id="search1week" name="search" value="<?php echo $oneweek?>"
				  class="buttonNormal" type="button" onclick="ajaxSearchLogViewtoSerBy7Days(1,'<?=$search?>','<?=$datecurrent?>','<?=$day7?>')"/>
	<input id="search1month" name="searchAll" value="<?php echo $one_month?>"
				  class="buttonNormal" type="button" onclick="ajaxSearchLogViewtoSerBy1Months(1,'<?=$search?>','<?=$datecurrent?>','<?=$onemonth?>')"/>
</div>
<div class="maind" style="padding-top: 15px;">
	<div id="logserver" style="padding-left: 40px;">
		<table width="100%" cellpadding="0" cellspacing="0" class="mtable" id="tbLogViewToServer">
			<thead>
				<tr>
					<td align="center" style="width: 4%;color: #696969;"><?php echo $no?></td>
					<td align="center"><a onclick="sortandpagingViewtoserver('<?=$page?>','ui.email',1,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')" style="cursor: pointer;color: #027acc"><?php echo $useriforid ?></a></td>
					<td align="center"><a onclick="sortandpagingViewtoserver('<?=$page?>','lvs.viewer_ip',1,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')" style="cursor: pointer;color: #027acc"><?php echo $remoteviewip ?></a></td>
					<td align="center"><a onclick="sortandpagingViewtoserver('<?=$page?>','lvs.server_ip',1,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')" style="cursor: pointer;color: #027acc"><?php echo $remoteserverip?></a></td>
					<td align="center"><a onclick="sortandpagingViewtoserver('<?=$page?>','lvs.status',1,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')" style="cursor: pointer;color: #027acc"><?php echo $status?></a></td>
					<td align="center"><a onclick="sortandpagingViewtoserver('<?=$page?>','lvs.ins_time',1,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')" style="cursor: pointer;color: #027acc"><?php echo $inserttime?></a></td>
				</tr>
			</thead>
			<?php
			if(mysql_num_rows($selectlogserver)>0){
				$i=0;
				while ($row = mysql_fetch_array($selectlogserver)){
					if ( $i >= $page_start ){?>
				<tr>
						<td align="center" style="width: 4%"><?php echo $i+1?></td>
						<td align="center"><?php echo $row[email] ?></td>
						<td align="center"><?php echo $row[viewer_ip] ?></td>
						<td align="center"><?php echo $row[server_ip]?></td>
						<td align="center"><?php echo $row[status]?></td>
						<td align="center"><?php echo $row[ins_time]?></td>
					</tr>
			<?php
					}
						$i++;
						if ($i >= $page_end){
							break;
						}
					}
				}
			?>
			
			<tr>
						<td colspan="8" class="rf-dt-shdr-c">
							<span style="padding:1px; display: inline-block;">
														
								<?php if ( $number_of_page > 1 ) 
								{ 
									if ($page==1)
										$p=2;
									else if ($page==$number_of_page)
										$p=$number_of_page-1;
									else $p=$page;
									if($page!=1){?>
										<a onclick="sortandpagingViewtoserver(<?=1?>,'<?=$str?>',0,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')"><span class='button_next'><?php echo "<<<";?></span> </a>
										<a onclick="sortandpagingViewtoserver(<?=($page-1)?>,'<?=$str?>',0,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')"><span class='button_next'><?php echo "<<";?></span> </a>
									<?php  }
									else{
										echo "<span class='button_next'><<<</span> "; 
										echo "<span class='button_next'><<</span> ";
									}
									for ( $i = $p-1; $i <= $p+1; $i++ ) {	
											if ($i<=$number_of_page && $i>0)
											
												if ($i==$page){
													echo "<span class='button_next'><b>".$i."</b></span>"; 
												}else{
												?>
													<a onclick="sortandpagingViewtoserver(<?=$i?>,'<?=$str?>',0,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')"><span class="button_next">
													<?php 
													echo $i;
													?>
													</span> </a>
													<?php 
												}
											?>
										
									<?php 
											}
										
										if($page!=$number_of_page){ ?>
											<a onclick="sortandpagingViewtoserver(<?=($page+1)?>,'<?=$str?>',0,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')"><span class='button_next'><?php echo ">>";?></span> </a>
											<a onclick="sortandpagingViewtoserver(<?=($number_of_page)?>,'<?=$str?>',0,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>')"><span class='button_next'><?php echo ">>>";?></span> </a>
										<?php }
										else{
											echo "<span class='button_next'>>></span> ";
											echo "<span class='button_next'>>>></span> ";
										}
									}
								
									
									?>
																						
							</span>
						</td>
					</tr>
		</table>
	</div>
</div>
<?php mysql_close($connection);?>